Produced by Araxis Merge on 2023-11-23 04:31:25 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | /Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme 4.0.6/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/js | layer.js | 2022-11-18 08:28:54 +0000 |
| 2 | /Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme 4.0.7/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/js | layer.js | 2022-11-18 08:28:54 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 1 | 622 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | /** | 1 | /** | |||
| 2 | * Copyright 2016 Mageplaza. All rights reserved. | 2 | * Copyright 2016 Mageplaza. All rights reserved. | |||
| 3 | * See https://www.mageplaza.com/LICENSE.txt for license details. | 3 | * See https://www.mageplaza.com/LICENSE.txt for license details. | |||
| 4 | */ | 4 | */ | |||
| 5 | define([ | 5 | define([ | |||
| 6 | 'jquery', | 6 | 'jquery', | |||
| 7 | 'productListToolbarForm' | 7 | 'productListToolbarForm' | |||
| 8 | ], function ($) { | 8 | ], function ($) { | |||
| 9 | "use strict"; | 9 | "use strict"; | |||
| 10 | var next_page = ""; | 10 | var next_page = ""; | |||
| 11 | var loading = false; | 11 | var loading = false; | |||
| 12 | var infinite_loaded_count = 0; | 12 | var infinite_loaded_count = 0; | |||
| 13 | var active = false; | 13 | var active = false; | |||
| 14 | $.widget('mageplaza.layer', { | 14 | $.widget('mageplaza.layer', { | |||
| 15 | 15 | |||||
| 16 | options: { | 16 | options: { | |||
| 17 | productsListSelector: '#layer-product-list', | 17 | productsListSelector: '#layer-product-list', | |||
| 18 | navigationSelector: '#layered-filter-block' | 18 | navigationSelector: '#layered-filter-block' | |||
| 19 | }, | 19 | }, | |||
| 20 | 20 | |||||
| 21 | _create: function () { | 21 | _create: function () { | |||
| 22 | this.initProductListUrl(); | 22 | this.initProductListUrl(); | |||
| 23 | this.initObserve(); | 23 | this.initObserve(); | |||
| 24 | this.initLoading(); | 24 | this.initLoading(); | |||
| 25 | this.inFinite(); | 25 | this.inFinite(); | |||
| 26 | }, | 26 | }, | |||
| 27 | 27 | |||||
| 28 | initProductListUrl: function () { | 28 | initProductListUrl: function () { | |||
| 29 | var self = this; | 29 | var self = this; | |||
| 30 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | 30 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | |||
| 31 | var urlPaths = this.options.url.split('?'), | 31 | var urlPaths = this.options.url.split('?'), | |||
| 32 | baseUrl = urlPaths[0], | 32 | baseUrl = urlPaths[0], | |||
| 33 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | 33 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | |||
| 34 | paramData = {}, | 34 | paramData = {}, | |||
| 35 | parameters; | 35 | parameters; | |||
| 36 | for (var i = 0; i < urlParams.length; i++) { | 36 | for (var i = 0; i < urlParams.length; i++) { | |||
| 37 | parameters = urlParams[i].split('='); | 37 | parameters = urlParams[i].split('='); | |||
| 38 | paramData[parameters[0]] = parameters[1] !== undefined | 38 | paramData[parameters[0]] = parameters[1] !== undefined | |||
| 39 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | 39 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | |||
| 40 | : ''; | 40 | : ''; | |||
| 41 | } | 41 | } | |||
| 42 | paramData[paramName] = paramValue; | 42 | paramData[paramName] = paramValue; | |||
| 43 | if (paramValue == defaultValue) { | 43 | if (paramValue == defaultValue) { | |||
| 44 | delete paramData[paramName]; | 44 | delete paramData[paramName]; | |||
| 45 | } | 45 | } | |||
| 46 | paramData = $.param(paramData); | 46 | paramData = $.param(paramData); | |||
| 47 | 47 | |||||
| 48 | self.ajaxSubmit(baseUrl + (paramData.length ? '?' + paramData : '')); | 48 | self.ajaxSubmit(baseUrl + (paramData.length ? '?' + paramData : '')); | |||
| 49 | } | 49 | } | |||
| 50 | }, | 50 | }, | |||
| 51 | 51 | |||||
| 52 | initObserve: function () { | 52 | initObserve: function () { | |||
| 53 | var self = this; | 53 | var self = this; | |||
| 54 | var aElements = this.element.find('a'); | 54 | var aElements = this.element.find('a'); | |||
| 55 | aElements.each(function (index) { | 55 | aElements.each(function (index) { | |||
| 56 | var el = $(this); | 56 | var el = $(this); | |||
| 57 | var link = self.checkUrl(el.prop('href')); | 57 | var link = self.checkUrl(el.prop('href')); | |||
| 58 | if(!link) return; | 58 | if(!link) return; | |||
| 59 | 59 | |||||
| 60 | el.bind('click', function (e) { | 60 | el.bind('click', function (e) { | |||
| 61 | if (el.hasClass('swatch-option-link-layered')) { | 61 | if (el.hasClass('swatch-option-link-layered')) { | |||
| 62 | var childEl = el.find('.swatch-option'); | 62 | var childEl = el.find('.swatch-option'); | |||
| 63 | childEl.addClass('selected'); | 63 | childEl.addClass('selected'); | |||
| 64 | } else { | 64 | } else { | |||
| 65 | var checkboxEl = el.find('input[type=checkbox]'); | 65 | var checkboxEl = el.find('input[type=checkbox]'); | |||
| 66 | checkboxEl.prop('checked', !checkboxEl.prop('checked')); | 66 | checkboxEl.prop('checked', !checkboxEl.prop('checked')); | |||
| 67 | } | 67 | } | |||
| 68 | 68 | |||||
| 69 | self.ajaxSubmit(link); | 69 | self.ajaxSubmit(link); | |||
| 70 | e.stopPropagation(); | 70 | e.stopPropagation(); | |||
| 71 | e.preventDefault(); | 71 | e.preventDefault(); | |||
| 72 | }); | 72 | }); | |||
| 73 | 73 | |||||
| 74 | var checkbox = el.find('input[type=checkbox]'); | 74 | var checkbox = el.find('input[type=checkbox]'); | |||
| 75 | checkbox.bind('click', function (e) { | 75 | checkbox.bind('click', function (e) { | |||
| 76 | self.ajaxSubmit(link); | 76 | self.ajaxSubmit(link); | |||
| 77 | e.stopPropagation(); | 77 | e.stopPropagation(); | |||
| 78 | }); | 78 | }); | |||
| 79 | }); | 79 | }); | |||
| 80 | 80 | |||||
| 81 | $(".filter-current a").bind('click', function (e) { | 81 | $(".filter-current a").bind('click', function (e) { | |||
| 82 | var link = self.checkUrl($(this).prop('href')); | 82 | var link = self.checkUrl($(this).prop('href')); | |||
| 83 | if(!link) return; | 83 | if(!link) return; | |||
| 84 | 84 | |||||
| 85 | self.ajaxSubmit(link); | 85 | self.ajaxSubmit(link); | |||
| 86 | e.stopPropagation(); | 86 | e.stopPropagation(); | |||
| 87 | e.preventDefault(); | 87 | e.preventDefault(); | |||
| 88 | }); | 88 | }); | |||
| 89 | 89 | |||||
| 90 | $(".filter-actions a").bind('click', function (e) { | 90 | $(".filter-actions a").bind('click', function (e) { | |||
| 91 | var link = self.checkUrl($(this).prop('href')); | 91 | var link = self.checkUrl($(this).prop('href')); | |||
| 92 | if(!link) return; | 92 | if(!link) return; | |||
| 93 | 93 | |||||
| 94 | self.ajaxSubmit(link); | 94 | self.ajaxSubmit(link); | |||
| 95 | e.stopPropagation(); | 95 | e.stopPropagation(); | |||
| 96 | e.preventDefault(); | 96 | e.preventDefault(); | |||
| 97 | }); | 97 | }); | |||
| 98 | }, | 98 | }, | |||
| 99 | 99 | |||||
| 100 | checkUrl: function (url) { | 100 | checkUrl: function (url) { | |||
| 101 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | 101 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | |||
| 102 | 102 | |||||
| 103 | return regex.test(url) ? url : null; | 103 | return regex.test(url) ? url : null; | |||
| 104 | }, | 104 | }, | |||
| 105 | 105 | |||||
| 106 | initLoading: function () { | 106 | initLoading: function () { | |||
| 107 | 107 | |||||
| 108 | }, | 108 | }, | |||
| 109 | 109 | |||||
| 110 | inFinite: function() { | 110 | inFinite: function() { | |||
| 111 | var self = this; | 111 | var self = this; | |||
| 112 | next_page = ""; | 112 | next_page = ""; | |||
| 113 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | 113 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | |||
| 114 | active = true; | 114 | active = true; | |||
| 115 | } | 115 | } | |||
| 116 | $(".pages-items li > a.next").each(function(){ | 116 | $(".pages-items li > a.next").each(function(){ | |||
| 117 | next_page = $(this).attr("href"); | 117 | next_page = $(this).attr("href"); | |||
| 118 | }); | 118 | }); | |||
| 119 | $(window).scroll(function(){ | 119 | $(window).scroll(function(){ | |||
| 120 | if(!loading && next_page && active && $(".infinite-loader").hasClass('scrolling') && $(window).scrollTop() >= $(".infinite-loader").offset().top-$(window).height()+100){ | 120 | if(!loading && next_page && active && $(".infinite-loader").hasClass('scrolling') && $(window).scrollTop() >= $(".infinite-loader").offset().top-$(window).height()+100){ | |||
| 121 | loading = true; | 121 | loading = true; | |||
| 122 | $(".pages-items li > a.next").each(function(){ | 122 | $(".pages-items li > a.next").each(function(){ | |||
| 123 | next_page = $(this).attr("href"); | 123 | next_page = $(this).attr("href"); | |||
| 124 | }); | 124 | }); | |||
| 125 | self.ajaxInfinite(next_page); | 125 | self.ajaxInfinite(next_page); | |||
| 126 | } | 126 | } | |||
| 127 | }); | 127 | }); | |||
| 128 | $(".infinite-loader .btn-load-more").click(function(){ | 128 | $(".infinite-loader .btn-load-more").click(function(){ | |||
| 129 | if(!loading && next_page && infinite_loaded_count >= 2){ | 129 | if(!loading && next_page && infinite_loaded_count >= 2){ | |||
| 130 | loading = true; | 130 | loading = true; | |||
| 131 | self.ajaxInfinite(next_page); | 131 | self.ajaxInfinite(next_page); | |||
| 132 | } | 132 | } | |||
| 133 | }); | 133 | }); | |||
| 134 | }, | 134 | }, | |||
| 135 | 135 | |||||
| 136 | ajaxInfinite: function (submitUrl) { | 136 | ajaxInfinite: function (submitUrl) { | |||
| 137 | var self = this; | 137 | var self = this; | |||
| 138 | infinite_loaded_count++; | 138 | infinite_loaded_count++; | |||
| 139 | $('.infinite-loader .btn-load-more').hide(); | 139 | $('.infinite-loader .btn-load-more').hide(); | |||
| 140 | $('.infinite-loader .loading').hide(); | 140 | $('.infinite-loader .loading').hide(); | |||
| 141 | $.ajax({ | 141 | $.ajax({ | |||
| 142 | url: submitUrl, | 142 | url: submitUrl, | |||
| 143 | data: {isAjax: 1}, | 143 | data: {isAjax: 1}, | |||
| 144 | type: 'post', | 144 | type: 'post', | |||
| 145 | dataType: 'json', | 145 | dataType: 'json', | |||
| 146 | beforeSend: function () { | 146 | beforeSend: function () { | |||
| 147 | $('.infinite-loader .btn-load-more').hide(); | 147 | $('.infinite-loader .btn-load-more').hide(); | |||
| 148 | $('.infinite-loader .loading').show(); | 148 | $('.infinite-loader .loading').show(); | |||
| 149 | }, | 149 | }, | |||
| 150 | success: function (res) { | 150 | success: function (res) { | |||
| 151 | loading = false; | 151 | loading = false; | |||
| 152 | if (res.backUrl) { | 152 | if (res.backUrl) { | |||
| 153 | window.location = res.backUrl; | 153 | window.location = res.backUrl; | |||
| 154 | return; | 154 | return; | |||
| 155 | } | 155 | } | |||
| 156 | if (res.products) { | 156 | if (res.products) { | |||
| 157 | if($(res.products).find('div.products-grid')){ | 157 | if($(res.products).find('div.products-grid')){ | |||
| 158 | var items_grid = $(res.products).find('div.products-grid.wrapper .product-items .item'); | 158 | var items_grid = $(res.products).find('div.products-grid.wrapper .product-items .item'); | |||
| 159 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | 159 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | |||
| 160 | $(self.options.productsListSelector).trigger('contentUpdated'); | 160 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 161 | } | 161 | } | |||
| 162 | if($(res.products).find('div.products-list')){ | 162 | if($(res.products).find('div.products-list')){ | |||
| 163 | var items_list = $(res.products).find('div.products-list.wrapper .product-items .item'); | 163 | var items_list = $(res.products).find('div.products-list.wrapper .product-items .item'); | |||
| 164 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | 164 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | |||
| 165 | $(self.options.productsListSelector).trigger('contentUpdated'); | 165 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 166 | } | 166 | } | |||
| 167 | if($(res.products).find('.pages a.next').length > 0){ | 167 | if($(res.products).find('.pages a.next').length > 0){ | |||
| 168 | $(self.options.productsListSelector + ' .pages a.next').attr('href', $(res.products).find('.pages a.next').attr('href')); | 168 | $(self.options.productsListSelector + ' .pages a.next').attr('href', $(res.products).find('.pages a.next').attr('href')); | |||
| 169 | }else{ | 169 | }else{ | |||
| 170 | $(self.options.productsListSelector + ' .pages a.next').remove(); | 170 | $(self.options.productsListSelector + ' .pages a.next').remove(); | |||
| 171 | } | 171 | } | |||
| 172 | if($("form[data-role=tocart-form]").length > 0) { | 172 | if($("form[data-role=tocart-form]").length > 0) { | |||
| 173 | $("form[data-role=tocart-form]").catalogAddToCart(); | 173 | $("form[data-role=tocart-form]").catalogAddToCart(); | |||
| 174 | } | 174 | } | |||
| 175 | $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); | 175 | $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); | |||
| 176 | $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); | 176 | $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); | |||
| 177 | $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); | 177 | $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); | |||
| 178 | $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); | 178 | $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); | |||
| 179 | $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); | 179 | $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); | |||
| 180 | $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); | 180 | $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); | |||
| 181 | $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); | 181 | $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); | |||
| 182 | $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); | 182 | $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); | |||
| 183 | $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); | 183 | $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); | |||
| 184 | $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); | 184 | $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); | |||
| 185 | $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); | 185 | $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); | |||
| 186 | $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); | 186 | $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); | |||
| 187 | $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); | 187 | $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); | |||
| 188 | $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); | 188 | $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); | |||
| 189 | var hist = submitUrl; | 189 | var hist = submitUrl; | |||
| 190 | if(submitUrl.indexOf("p=") > -1){ | 190 | if(submitUrl.indexOf("p=") > -1){ | |||
| 191 | var len = submitUrl.length-submitUrl.indexOf("p="); | 191 | var len = submitUrl.length-submitUrl.indexOf("p="); | |||
| 192 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | 192 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | |||
| 193 | var page_param = ""; | 193 | var page_param = ""; | |||
| 194 | if(str_temp.indexOf("&") == -1){ | 194 | if(str_temp.indexOf("&") == -1){ | |||
| 195 | page_param = str_temp; | 195 | page_param = str_temp; | |||
| 196 | } else { | 196 | } else { | |||
| 197 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | 197 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | |||
| 198 | } | 198 | } | |||
| 199 | hist = submitUrl.replace(page_param, ""); | 199 | hist = submitUrl.replace(page_param, ""); | |||
| 200 | } | 200 | } | |||
| 201 | if (typeof window.history.pushState === 'function') { | 201 | if (typeof window.history.pushState === 'function') { | |||
| 202 | window.history.pushState({url: hist}, '', hist); | 202 | window.history.pushState({url: hist}, '', hist); | |||
| 203 | } | 203 | } | |||
| 204 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | 204 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||
| 205 | requirejs(['jquery', 'weltpixel_quickview' ], | 205 | requirejs(['jquery', 'weltpixel_quickview' ], | |||
| 206 | function($, quickview) { | 206 | function($, quickview) { | |||
| 207 | $('.weltpixel-quickview').off('click').on('click', function() { | 207 | $('.weltpixel-quickview').off('click').on('click', function() { | |||
| 208 | var prodUrl = $(this).attr('data-quickview-url'); | 208 | var prodUrl = $(this).attr('data-quickview-url'); | |||
| 209 | if (prodUrl.length) { | 209 | if (prodUrl.length) { | |||
| 210 | quickview.displayContent(prodUrl); | 210 | quickview.displayContent(prodUrl); | |||
| 211 | } | 211 | } | |||
| 212 | }); | 212 | }); | |||
| 213 | }); | 213 | }); | |||
| 214 | } | 214 | } | |||
| 215 | $(".products-grid .weltpixel-quickview").each(function(){ | 215 | $(".products-grid .weltpixel-quickview").each(function(){ | |||
| 216 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | 216 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | |||
| 217 | }); | 217 | }); | |||
| 218 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | 218 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | |||
| 219 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | 219 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | |||
| 220 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { | 220 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { | |||
| 221 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 221 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 222 | }); | 222 | }); | |||
| 223 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | 223 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | |||
| 224 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 224 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 225 | }); | 225 | }); | |||
| 226 | } | 226 | } | |||
| 227 | next_page = ""; | 227 | next_page = ""; | |||
| 228 | $(".pages-items li > a.next").each(function(){ | 228 | $(".pages-items li > a.next").each(function(){ | |||
| 229 | next_page = $(this).attr("href"); | 229 | next_page = $(this).attr("href"); | |||
| 230 | }); | 230 | }); | |||
| 231 | if(infinite_loaded_count >= 2){ | 231 | if(infinite_loaded_count >= 2){ | |||
| 232 | $('.infinite-loader .loading').hide(); | 232 | $('.infinite-loader .loading').hide(); | |||
| 233 | if(next_page){ | 233 | if(next_page){ | |||
| 234 | $('.infinite-loader .btn-load-more').show(); | 234 | $('.infinite-loader .btn-load-more').show(); | |||
| 235 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | 235 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | |||
| 236 | if(!loading && next_page && infinite_loaded_count >= 2){ | 236 | if(!loading && next_page && infinite_loaded_count >= 2){ | |||
| 237 | loading = true; | 237 | loading = true; | |||
| 238 | self.ajaxInfinite(next_page); | 238 | self.ajaxInfinite(next_page); | |||
| 239 | } | 239 | } | |||
| 240 | }); | 240 | }); | |||
| 241 | } | 241 | } | |||
| 242 | } else { | 242 | } else { | |||
| 243 | $('.infinite-loader .loading').fadeOut(300); | 243 | $('.infinite-loader .loading').fadeOut(300); | |||
| 244 | } | 244 | } | |||
| 245 | } | 245 | } | |||
| 246 | 246 | |||||
| 247 | }, | 247 | }, | |||
| 248 | error: function () { | 248 | error: function () { | |||
| 249 | window.location.reload(); | 249 | window.location.reload(); | |||
| 250 | } | 250 | } | |||
| 251 | }); | 251 | }); | |||
| 252 | }, | 252 | }, | |||
| 253 | 253 | |||||
| 254 | ajaxSubmit: function (submitUrl) { | 254 | ajaxSubmit: function (submitUrl) { | |||
| 255 | var self = this; | 255 | var self = this; | |||
| 256 | infinite_loaded_count = 0; | 256 | infinite_loaded_count = 0; | |||
| 257 | $.ajax({ | 257 | $.ajax({ | |||
| 258 | url: submitUrl, | 258 | url: submitUrl, | |||
| 259 | data: {isAjax: 1}, | 259 | data: {isAjax: 1}, | |||
| 260 | type: 'post', | 260 | type: 'post', | |||
| 261 | dataType: 'json', | 261 | dataType: 'json', | |||
| 262 | beforeSend: function () { | 262 | beforeSend: function () { | |||
| 263 | $('.ln_overlay').show(); | 263 | $('.ln_overlay').show(); | |||
| 264 | if (typeof window.history.pushState === 'function') { | 264 | if (typeof window.history.pushState === 'function') { | |||
| 265 | window.history.pushState({url: submitUrl}, '', submitUrl); | 265 | window.history.pushState({url: submitUrl}, '', submitUrl); | |||
| 266 | } | 266 | } | |||
| 267 | }, | 267 | }, | |||
| 268 | success: function (res) { | 268 | success: function (res) { | |||
| 269 | if (res.backUrl) { | 269 | if (res.backUrl) { | |||
| 270 | window.location = res.backUrl; | 270 | window.location = res.backUrl; | |||
| 271 | return; | 271 | return; | |||
| 272 | } | 272 | } | |||
| 273 | if (res.navigation) { | 273 | if (res.navigation) { | |||
| 274 | $(self.options.navigationSelector).replaceWith(res.navigation); | 274 | $(self.options.navigationSelector).replaceWith(res.navigation); | |||
| 275 | $(self.options.navigationSelector).trigger('contentUpdated'); | 275 | $(self.options.navigationSelector).trigger('contentUpdated'); | |||
| 276 | } | 276 | } | |||
| 277 | if (res.products) { | 277 | if (res.products) { | |||
| 278 | $(self.options.productsListSelector).replaceWith(res.products); | 278 | $(self.options.productsListSelector).replaceWith(res.products); | |||
| 279 | $(self.options.productsListSelector).trigger('contentUpdated'); | 279 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 280 | } | 280 | } | |||
| 281 | $('.ln_overlay').hide(); | 281 | $('.ln_overlay').hide(); | |||
| 282 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | 282 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||
| 283 | requirejs(['jquery', 'weltpixel_quickview' ], | 283 | requirejs(['jquery', 'weltpixel_quickview' ], | |||
| 284 | function($, quickview) { | 284 | function($, quickview) { | |||
| 285 | $('.weltpixel-quickview').off('click').on('click', function() { | 285 | $('.weltpixel-quickview').off('click').on('click', function() { | |||
| 286 | var prodUrl = $(this).attr('data-quickview-url'); | 286 | var prodUrl = $(this).attr('data-quickview-url'); | |||
| 287 | if (prodUrl.length) { | 287 | if (prodUrl.length) { | |||
| 288 | quickview.displayContent(prodUrl); | 288 | quickview.displayContent(prodUrl); | |||
| 289 | } | 289 | } | |||
| 290 | }); | 290 | }); | |||
| 291 | }); | 291 | }); | |||
| 292 | } | 292 | } | |||
| 293 | $(".products-grid .weltpixel-quickview").each(function(){ | 293 | $(".products-grid .weltpixel-quickview").each(function(){ | |||
| 294 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | 294 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | |||
| 295 | }); | 295 | }); | |||
| 296 | $("#layer-product-list img.porto-lazyload").lazyload({effect:"fadeIn"}); | 296 | $("#layer-product-list img.porto-lazyload").lazyload({effect:"fadeIn"}); | |||
| 297 | if ($('#layer-product-list .porto-lazyload').closest('.owl-carousel').length) { | 297 | if ($('#layer-product-list .porto-lazyload').closest('.owl-carousel').length) { | |||
| 298 | $('#layer-product-list .porto-lazyload').closest('.owl-carousel').on('changed.owl.carousel', function() { | 298 | $('#layer-product-list .porto-lazyload').closest('.owl-carousel').on('changed.owl.carousel', function() { | |||
| 299 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 299 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 300 | }); | 300 | }); | |||
| 301 | } | 301 | } | |||
| 302 | }, | 302 | }, | |||
| 303 | error: function () { | 303 | error: function () { | |||
| 304 | window.location.reload(); | 304 | window.location.reload(); | |||
| 305 | } | 305 | } | |||
| 306 | }); | 306 | }); | |||
| 307 | } | 307 | } | |||
| 308 | }); | 308 | }); | |||
| 309 | 309 | |||||
| 310 | return $.mageplaza.layer; | 310 | return $.mageplaza.layer; | |||
| 311 | }); | 311 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.